<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script>
       var a;
        alert(a);
        function test(){
            var val = "2"-1;
            alert("（\"2\"-1）val类型为："+typeof val+",val的值为："+val); //number类型
            var val = "2"+1;
            alert("（\"2\"+1）val类型为："+typeof val+",val的值为："+val); //string类型
        }
    </script>
</head>
<body>
<input type="button" onclick="test()" value="测试" >
</body>
</html>